<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script src="/static/js/common.js"></script>
    <script src="/static/js/jquery-1.11.3.js"></script>

    <script>
        $(function(){
            //绑定blur事件
            $('#uname').blur(function(){
            //1.创建xhr
            var xhr = createXhr();
            //2.创建请求
            var url = '/user/checkuname/?uname=' + $("#uname").val();
            xhr.open('get', url, true);
            //3.设置回调
            xhr.onreadystatechange=function(){
               if (xhr.readyState == 4 && xhr.status == 200){
                    $('#show').html(xhr.responseText);
               }
            }
           //4.send发送请求
           xhr.send(null);
        });
     });





    </script>



    <p>
        用户名：　<input type="text" id="uname">
        <span id="show"></span>
    </p>

    <p>
        密码：　<input type="password" id="pwd">
    </p>

    <p>
        <button id="btn">提交</button>
    </p>



</body>
</html>